
;
; 69 positions - main part sourcecode
; by Raf/Vulture Design
;

;.incprg loader.prg ; $8000
;.incprg deexo.prg ; $9300 /////; $8500
;.include ..\kolekcja\deexo.asm
;loader = $8000
;;;;;;;;;;;;;;;;;;;;;
; dload stuff
iloader = $9000

loadfile = iloader
loadts = iloader+3
shutup = iloader+6
wakeup = iloader+9
ledoff = iloader+12
speederoff = iloader+15
;;;;;;;;;;;;;;;;;;;;;;;;;;;

	*=$3000

.include "_tuneload.asm"
.include "_fld.asm"
.include "_ss.asm"
.include "_clock.asm"

.incprg font.prg,l ;$3e00-3fff
.incprg mainmenu.prg,l ;$4000-$6800

        *= $6c00

;.incbin "kleps.raw"	; please wait 176
.incbin "kleps3.raw"	; please wait 176
.byte 0
;.incbin "arrow4.raw"	; arrow 177
.incbin "dick1.raw"	; dickarrow ;-) 177
.byte 0
.incbin "deexo.raw"	; uncompressing 178
.byte 0
.incbin "loading.raw"	; loading 179
.byte 0
.incbin "pause.raw"	; 180
.byte 0
.incbin "play.raw"	; 181
.byte 0
.incbin "stop.raw"	; 182
.byte 0
.incbin "disk.raw"	; 183 diskerror
.byte 0


iwait = 176
iarrow = 177
iunpack = 178
iload = 179
ipause = 180
iplay = 181
istop = 182
idisk = 183

;184  , 185 - for spritescroller

imbox = 196
ijbox = 197



; 186

	*=$6e80

.incbin "0.raw"
.byte 0
.incbin "1.raw"
.byte 0
.incbin "2.raw"
.byte 0
.incbin "3.raw"
.byte 0
.incbin "4.raw"
.byte 0
.incbin "5.raw"
.byte 0
.incbin "6.raw"
.byte 0
.incbin "7.raw"
.byte 0
.incbin "8.raw"
.byte 0
.incbin "9.raw"
.byte 0

 ;#196
.incbin "mbox.raw" ; manualbox
.byte 0
.incbin "jbox.raw" ; 3 minute jukebox
.byte 0



;----- Paragraph @start@ -----

	*= $8000

	LDA #0
	STA $d01d
	


	lda #$08
	sta $d021

ok2
 	lda #$a0         ;SET SCREEN
 	sta $d018

        jsr colors
;
 	lda #2
 	sta $dd00
;
 	lda $d016
 	ora #16
 	sta $d016



 ;	lda #$1b
 ;	sta $d011

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

        sei

	lda #$F1
	sta $D01a

	lda #<irqfld
	ldy #>irqfld
	sta $0314
	sty $0315

	lda #$01
	sta $D012
	lda $d011
	and #127
	sta $d011

	;jsr stop
        lda #1
        sta graj
	cli

	sta $d02e 	; kolor ikony

	lda #$01
	sta liczba
	jsr rysuj

	

     
        lda #13
        sta $d028
        sta $d029
        sta $d02a
        sta $d02b
        sta $d02c
        sta $d02d

 
        lda #64
        sta $d000
        sta $d001
        lda #177
        sta $6c00-8

        lda #0
        tax
abcd        sta $7200,x
        sta $7300,x
        dex
        bne abcd


    

        lda #iplay	; ikona
        sta $6c00-1


	jsr scrollsetup
  	jsr put_lcd

	lda #40
	sta $d00e ; ikona na dole
	lda #255
	sta $d00f

;        lda #4
 ;       sta $d020

;        jsr loading
 ;       jsr tuneload
  ;      jsr loaded

	jsr rysuj ; pierwsze rysowanieznakow na ekranie

.include "_chkkbd.asm"

; procedures' start or wot? ;p
;;;;;;;;;;;;;;;;;;;;;;;;;;;;

init    lda #$00
 	sta graj
	lda loadptr
	bne initk
        tax
	tay
	jsr $1000
	lda #$01
	sta graj
	lda # iplay
	sta $6c00-1
	jsr clk_reset
initk	rts

stop	lda #$00
	sta graj
	jsr reset_sid
	lda #istop
	sta $6c00-1
        rts

.include "_hidden.asm"

.include "_rysuj.asm"

.include "_irq.asm"


;----- Paragraph @przelicz@ -----

pozycja .byte 0
znak .byte 0
liczba .byte 0	; used as current tune indicator too
potega .byte 0

liczba_tmp .byte 0

przelicz	lda #15
		sta pozycja
		lda #1
		sta potega
pdalej
                ldy pozycja
		lda liczba
		and potega
		bne set1

set0		lda #"0"
		sta fname,y
		jmp nextem
set1		lda #"1"
		sta fname,y
nextem
                dec pozycja
		asl potega
		cpy #8
		beq konieccc
		jmp pdalej
konieccc
                rts

;-----------------------------------------------

.include "_checkjoy.asm"

reset_sid
         ldy #27
         lda #0
_rs         sta $d400,y
         dey
         bpl _rs
         rts
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

fname
.text "0000000000000000"
fnamel = * - fname

;fnames
;.text "names"
;fnamesl = * - fnames


;.byte 13,0

colors
                             ldx #$00
__lo1
			lda $5f40,x
			sta $6800,x

			lda $6040,x
			sta $6900,x

			lda $6140,x
			sta $6a00,x

			lda $6240,x
			sta $6b00,x

			lda $6328,x
			sta $d800,x

			lda $6428,x
			sta $d900,x

			lda $6528,x
			sta $da00,x

			lda $6628,x
			sta $db00,x

			dex
			bne __lo1

                        lda $6710
                        sta $d021

	rts



loading                 inc loadptr
                        lda #176
                        sta $6c00-8
                        rts

loaded                  dec loadptr
                        lda #177
                        sta $6c00-8
                        rts

sinusp .byte $0f

SINUS .byte $31,$30,$30,$2F,$2E,$2D
      .byte $2C,$2C,$2B,$2B,$2B,$2B
      .byte $2B,$2C,$2D,$2F,$30,$32
      .byte $34,$35,$37,$39,$3B,$3C
      .byte $3D,$3E,$3E,$3E,$3D,$3D
      .byte $3B,$3A,$38,$35,$33,$30
      .byte $2E,$2B,$29,$26,$24,$22
      .byte $20,$1F,$1E,$1E,$1E,$1E
      .byte $1F,$20,$22,$23,$25,$27
      .byte $29,$2B,$2C,$2E,$2F,$30
      .byte $31,$31,$31,$31

put_lcd

      ; ustawianie sprajtow od "lcd"

       lda #126	; Y expand
        sta $d017


        lda #105+80+5
        sta $d003
        sta $d005
        sta $d007
        sta $d009
        sta $d00b
        sta $d00d
        lda #70+34
        sta $d002
        lda #94+34
        sta $d004
        lda #118+34
        sta $d006
        lda #142+34
        sta $d008
        lda #166+34
        sta $d00a
        lda #190+34
        sta $d00c
; set sprite pointers        
	lda #200
        sta $6c00-7
        lda #201
        sta $6c00-6
        lda #202
        sta $6c00-5
        lda #203
        sta $6c00-4
        lda #204
        sta $6c00-3
        lda #205
        sta $6c00-2        
        
        rts